package org.liveboardgames.agricola.control.delegates.action.processor
{
    import org.liveboardgames.agricola.control.delegates.helper.GameHelper;
    import org.liveboardgames.agricola.model.AgricolaModelLocator;
    import org.liveboardgames.agricola.model.PopupModel;
    import org.liveboardgames.agricola.vo.action.Action;
    import org.liveboardgames.agricola.vo.player.Player;
    
    public class FencesActionProcessor extends ActionProcessor
    {
        public function FencesActionProcessor(action:Action)
        {
            super(action);
        }
        
        override public function execute():void
        {
            var availableFences:int = GameHelper.computeAvailableFences(Player(action.target).farm);
            
            AgricolaModelLocator.getInstance().popups.currentActionPopupIndex = PopupModel.POPUP_FENCES_INDEX;
            AgricolaModelLocator.getInstance().popups.numberOfAvailableFences = availableFences;
        }
    }
}